
#ifndef BROADPHASE_H_
#define BROADPHASE_H_

#include "Core.h"
#include "Aabb2.h"

namespace p2 {

class BroadPhaseObserver
{
public:
    virtual ~BroadPhaseObserver();
    virtual bool addPair(void* data0, void* data1) = 0;
    virtual bool removePair(void* data0, void* data1) = 0;
};

class BroadPhase
{
public:
    virtual ~BroadPhase();

	inline void setObserver(BroadPhaseObserver* observer);

	virtual uint32 addObject(Aabb2<real> const& box, uint32 plane, void* userData, bool commitObject = true) = 0;
    virtual void removeObject(uint32 objId) = 0;
    virtual void updateObject(Aabb2<real> const& box, uint32 objId) = 0;
    virtual void updateNotify() = 0;

protected:
    inline BroadPhase();
    BroadPhaseObserver* _observer;
};

inline BroadPhase::BroadPhase()
: _observer(NULL)
{
}

inline void BroadPhase::setObserver(BroadPhaseObserver* observer)
{
    _observer = observer;
}

}

#endif	//BROADPHASE_H_
